<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>车主</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" href="/sunfc/css/weui.css">
    <link rel="stylesheet" href="/sunfc/css/jquery-weui.css">
    <link rel="stylesheet" href="/sunfc/css/style.css">
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.2&key=fc8d203edc94af7f4fe3a3f02fb99a74"></script>

    <style type="text/css">

    </style>
</head>
<body class="back1">


<div class="index-top-fix">
    <div class="top">
        <p style="text-align: center;color:#ccc;">{$web_config['sitename']}</p>
    </div>
    <div class="bottom">
        <div class="tab-bottom">
            <a href="{:url('index/sunfc.passenger/index')}">乘客</a>
            <a href="javascript:;" class="cur">车主</a>
            <!--<div class="pao">月赚1500元</div>-->
        </div>
        <div style="position: absolute;right: 10px;top: 0;">
            <a href="tel:{$web_config.kefu_tel}"><img src="/sunfc/images/kefu.png" width="20" style="margin-right:12px;"></a>
            <a href="{:url('index/sunfc.users/index')}"><img src="/sunfc/images/user1.png" width="15"></a>
        </div>
    </div>
</div>

<!-- 这里写内容 -->
<div style="margin-top: 88px;">
</div>



    {if condition="$res neq ''"}

    {if condition="$res.status eq 0"}
    <!-- 待处理行程 -->
    <div class="index-box index-waitting">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/daichuli.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>待处理行程</p>
                </div>
            </div>

            <!--{:url('index/sunfc.publish/await_index')}-->

            <a class="weui-cell weui-cell_access left0" href="{:url('index/sunfc.publish/middle_index',['id'=>$res['id']])}">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/shal.png" width="40" height="40">
                </div>
                <div class="weui-cell__bd">
                    <p>{$res.depart_time}</p>
                    <p class="huic">
                        <!--{$res.begin_place}-->
                        <span>{$res.begin_detail}</span>
                        <img src="/sunfc/images/jiantou.png" width="15" />
                        <!--{$res.end_place}-->
                        <span>{$res.end_detail}</span>
                    </p>
                </div>
                <div class="weui-cell__ft">等待乘客</div>
            </a>

        </div>
    </div>
    {else if condition="$res.status eq 1" }
    <!-- 行程中 -->
    <div class="index-box index-xingchengz">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/daichuli.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>行程中</p>
                </div>
            </div>
            <div class="weui-cell left0">
                <div class="weui-cell__hd">
                    <div class="touxiang">
                        <img class="t-photo" src="{$res.headimgurl}" width="60" height="60">
                        <img class="t-icon" src="/sunfc/images/sex1.png" width="15">
                    </div>
                </div>
                <div class="weui-cell__bd pos-tel">
                    {if $res.realname != ''}
                    <p class="f17">{$res.realname}</p>
                    {else if $res.realname == '' }
                    <p class="f17">{$res.nickname}</p>
                    {/if}

                    <p class="xcz-chexing">
                        <span class="xinren">信任值80分</span>
                        <!--<span>华泰圣达菲</span>-->
                    </p>
                    <div class="pos-tel-abs">
                        {if  $res.phone == '' }
                        <a href="tel:{$res.tel}"><img src="/sunfc/images/tel.png" width="30"></a>
                        {else if $res.phone != ''}
                        <a href="tel:{$res.phone}"><img src="/sunfc/images/tel.png" width="30"></a>

                        {/if}


                    </div>
                </div>
            </div>
            <div class="weui-cell left0">

                <div class="weui-cell__bd xingchengz">

                    <div class="weui-cells">
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <img src="/sunfc/images/wait.png" width="8" class="wait">
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$res.depart_time}</span>
                                    <span class="font1">{$res.number}人</span>
                                    <!--<span class="font2">95%顺路</span>-->
                                </p>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <span class="dian"></span>
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$res.begin_place}</span>
                                    <span class="font1">{$res.begin_detail}</span>
                                </p>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd">
                                <span class="dian2"></span>
                            </div>
                            <div class="weui-cell__bd">
                                <p>
                                    <span>{$res.end_place}</span>
                                    <span class="font1">{$res.end_detail}</span>
                                </p>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="weui-cell left0">

                <div class="weui-cell__bd">
                    <p class="xingchengz-tel">
                        <span class="col1">请耐心等待</span>
                        <!--<a href="tel:13137683557" class="telephone"><img src="images/tel.png" width="20" />联系电话</a>-->
                        <!--<a href="行程中.html" class="telephone"><img src="images/xingcheng.png" width="15" /> 进入行程</a>-->
                        <a href="{:url('index/sunfc.publish/route_index',['order_id' => $res.id])}" class="telephone" style="padding: 0 16px;">进入行程</a>
                    </p>
                </div>
            </div>
        </div>
    </div>
    {/if}
    <div class="index-box index-waitting index-find">
    <div class="weui-cells">
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <img src="/sunfc/images/daichuli.png" width="20">
            </div>
            <div class="weui-cell__bd">
                <p>发现</p>
            </div>
        </div>

        <!--邀请车主-->
        <a class="weui-cell weui-cell_access left0" href="javascript:;">
            <div class="weui-cell__hd">
                <img src="/sunfc/images/liwu.png" width="20">
            </div>
            <!--邀请车主-->
            <div class="weui-cell__bd">
                <!--<a href="{:url('index/sunfc.publish/cat_owner')}">-->
                <p>邀请车主</p>
                <!--</a>-->
            </div>

            <div class="weui-cell__ft f13">立得20元<span class="yuan"></span></div>
        </a>

          {if $res.type == 1}
            <!--跨城乘客-->
            <a class="weui-cell weui-cell_access left0" href="javascript:;">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/chengshi.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>跨城乘客</p>
                </div>
                <div class="weui-cell__ft f13">{$sum}人</div>
            </a>
            <div class="NearbyPassengers">
                {volist name="coun_last" id="vo"}

                <a href="{:url('sunfc.publish/nearby_index',['end_place'=>$vo['end_place']])}">
                    {$vo['end_place']}<span>  {$vo['number']}人
                </span>
                </a>
                {/volist}
            </div>
        {else if $res.type == 2}
            <!--附近乘客-->
            <a class="weui-cell weui-cell_access left0" href="javascript:;">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/fujin.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>附近乘客</p>
                </div>
                <div class="weui-cell__ft f13">{$sum}人</div>
            </a>

            <div class="NearbyPassengers">

                {volist name="coun_last" id="vo"}
                <a href="{:url('sunfc.publish/nearby_index',['end_place'=>$vo['end_place']])}">
                    {$vo['end_place']}<span>  {$vo['number']}人
                </span>
                </a>
                {/volist}


            </div>

        {/if}


    </div>
</div>


    {else /}


<div id="app">


    <div class="weui-tab index-box index-kuashi">
        <div class="weui-navbar" id="navbarShi">
            <input type="hidden" name="region" id="region" value="1">


            <a class="weui-navbar__item weui-bar__item--on" href="#tab1" vid="0" onclick="sameCity()" >
                市内
            </a>

            <a class="weui-navbar__item" href="#tab2" vid="1" onclick="boastCity()">
                跨城
            </a>
        </div>
        <div class="weui-tab__bd">
            <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 open-popup" id="addressStart" style="cursor:pointer">你从哪儿出发</p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian2"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 col1 open-popup" id="addressEnd" style="cursor:pointer">你要去哪儿</p>
                        </div>
                    </div>
                </div>
            </div>
            <div id="tab2" class="weui-tab__bd-item">
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15" id="addressStartKua" style="cursor:pointer">你从哪儿出发</p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <span class="dian2"></span>
                        </div>
                        <div class="weui-cell__bd">
                            <p class="f15 col1" id="addressEndKua" style="cursor:pointer">你要去哪儿</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 发现 -->
    <div class="index-box index-waitting index-find">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/daichuli.png" width="20">
                </div>
                <div class="weui-cell__bd">
                    <p>发现</p>
                </div>
            </div>

            <!--邀请车主-->
            <a class="weui-cell weui-cell_access left0" href="javascript:;">
                <div class="weui-cell__hd">
                    <img src="/sunfc/images/liwu.png" width="20">
                </div>
                <!--邀请车主-->
                <div class="weui-cell__bd">
                    <!--<a href="{:url('index/sunfc.publish/cat_owner')}">-->
                    <p>邀请车主</p>
                    <!--</a>-->
                </div>

                <div class="weui-cell__ft f13">立得20元<span class="yuan"></span></div>
            </a>



            <div v-if="leg > 0">
                <!--跨城乘客-->
                <a class="weui-cell weui-cell_access left0" href="javascript:;">
                    <div class="weui-cell__hd">
                        <img src="/sunfc/images/chengshi.png" width="20">
                    </div>
                    <div class="weui-cell__bd">
                        <p>跨城乘客</p>
                    </div>
                    <div class="weui-cell__ft f13">{{boastCity[0].count}}人</div>
                </a>
                <div class="NearbyPassengers">

                    <a href="{:url('sunfc.publish/nearby_index',['region' =>'1','type' =>'1'])}"  v-for="item in boastCity">

                        {{item.end_place}}<span>{{item.number}}人</span>

                    </a>

                </div>
            </div>

            <div v-else>

                <!--附近乘客-->
                <a class="weui-cell weui-cell_access left0" href="javascript:;">
                    <div class="weui-cell__hd">
                        <img src="/sunfc/images/fujin.png" width="20">
                    </div>
                    <div class="weui-cell__bd">
                        <p>附近乘客</p>
                    </div>
                    <div class="weui-cell__ft f13">{{sameCity[0].count}}人</div>
                </a>
                <div class="NearbyPassengers">
                    <a href="{:url('sunfc.publish/nearby_index',['region' =>'1','type' =>'0'])}"  v-for="item in sameCity" >
                        {{item.end_detail}}<span>{{item.number}}人
                </span>
                    </a>

                </div>



            </div>


        </div>
    </div>

</div>
    {/if}





<div style="margin: 5px;">
    <img src="/sunfc/images/guanggao.jpg" style="width:100%">
</div>




<!--市内-你从哪儿出发-->
<div id="addressStartAll" class="weui-popup__container popup-address">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="popup-address-search">
            <div class="address" id="cityAddress">
                <span>周口</span>
                <img src="/sunfc/images/xia.png" width="20">
            </div>
            <input type="text" id="addressText1" placeholder="你从哪儿出发" name="addressText" onfocus='this.value=""'>
            <a href="javascript:;" class="close-popup" id="aaa">取消</a>
        </div>
    </div>
</div>
<!--市内-你要去哪儿-->
<div id="addressStartAll2" class="weui-popup__container popup-address">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="popup-address-search">
            <div class="address" id="cityAddress2">
                <span>周口</span>
                <img src="/sunfc/images/xia.png" width="20">
            </div>
            <input type="text" id="addressText2" placeholder="你要去哪儿" name="addressText" onfocus='this.value=""'>
            <a href="javascript:;" class="close-popup" id="aaa2">取消</a>
        </div>
    </div>
</div>

<!--跨市-你从哪儿出发-->
<div id="addressStartAll3" class="weui-popup__container popup-address">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="popup-address-search">
            <div class="address" id="cityAddress3">
                <span>周口</span>
                <img src="/sunfc/images/xia.png" width="20">
            </div>
            <input type="text" id="addressText3" placeholder="你从哪儿出发" name="addressText" onfocus='this.value=""'>
            <a href="javascript:;" class="close-popup" id="aaa3">取消</a>
        </div>
    </div>
</div>
<!--跨市-你要去哪儿-->
<div id="addressStartAll4" class="weui-popup__container popup-address">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="popup-address-search">
            <div class="address" id="cityAddress4">
                <span>周口</span>
                <img src="/sunfc/images/xia.png" width="20">
            </div>
            <input type="text" id="addressText4" placeholder="你要去哪儿" name="addressText" onfocus='this.value=""'>
            <a href="javascript:;" class="close-popup" id="aaa4">取消</a>
        </div>
    </div>
</div>



<div class="demos-content-padded">
    <div class="weui-footer">
        <p class="weui-footer__text">技术支持-机智物联</p>
    </div>

</div>

<div class="pos-city-box index-box" id="posCityBox" style="display: none;">
    <a href="javascirpt:;">周口</a>
    <a href="javascirpt:;">郑州</a>
    <a href="javascirpt:;">信阳</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">三门峡</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">鹤壁</a>
    <a href="javascirpt:;">平顶山</a>
</div>

<div class="pos-city-box index-box" id="posCityBox2" style="display: none;">
    <a href="javascirpt:;">周口</a>
    <a href="javascirpt:;">郑州</a>
    <a href="javascirpt:;">信阳</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">三门峡</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">鹤壁</a>
    <a href="javascirpt:;">平顶山</a>
</div>

<div class="pos-city-box index-box" id="posCityBox3" style="display: none;">
    <a href="javascirpt:;">周口</a>
    <a href="javascirpt:;">郑州</a>
    <a href="javascirpt:;">信阳</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">三门峡</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">鹤壁</a>
    <a href="javascirpt:;">平顶山</a>
</div>

<div class="pos-city-box index-box" id="posCityBox4" style="display: none;">
    <a href="javascirpt:;">周口</a>
    <a href="javascirpt:;">郑州</a>
    <a href="javascirpt:;">信阳</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">三门峡</a>
    <a href="javascirpt:;">安阳</a>
    <a href="javascirpt:;">鹤壁</a>
    <a href="javascirpt:;">平顶山</a>
</div>


<script src="/sunfc/js/jquery.min.js"></script>
<script src="/sunfc/js/jquery-weui.min.js"></script>
<script src="/sunfc/js/store.js"></script>
<style>
    .demos-content-padded{padding:15px}
    .amap-sug-result{width:94%;left: 3%!important;border:0;background:#fff;border-radius: 2px;box-shadow:0px 0px  10px 3px #e7e7e7;top:46px;}
    .auto-item-span{display:block;padding-left:0;font-size: 13px;color:#939393;}
    .auto-item{background: url("/sunfc/images/wait.png") no-repeat left 7% center;background-size: auto 17%;padding-left:12%;font-size: 15px;line-height: 24px;border-bottom: 1px solid #e5e5e5;}
</style>

<script>
    //拿到值------市内还是跨城

    function get_region() {
        //需要延迟一下
        setTimeout(function () {
            var aa=$('.weui-bar__item--on')[0].innerText;
            $('#region').val(aa);
            if(aa=='市内'){
                aa=0;
            }
            else {
                aa=1;
            }


            console.log( "当前状态:"+aa);
        }, 5);
    }

    // 切换城市
    $(document).on("click", "#cityAddress", function() {
        $("#posCityBox").show();
    });
    var autoOptions;
    $.each($("#posCityBox a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress span").text($(this).text());
            $("#posCityBox").hide();
            autoOptions = {
                city: $("#cityAddress span").text(), 								// 城市，默认全国
                input: "addressText1"						// 使用联想输入的input的id
            };
            cityChoice(autoOptions);
        });
    });
    cityChoice(autoOptions);
    function cityChoice(autoOptions, vcity){

        AMap.plugin(['AMap.Autocomplete','AMap.PlaceSearch'],function() {
            var placeSearch = new AMap.PlaceSearch({
                city: '周口',
                map: map
            })
            // 你从哪儿出发-本市
            if(autoOptions == undefined){
                autoOptions = {
                    city: '周口', 								// 城市，默认全国
                    input: "addressText1"						// 使用联想输入的input的id
                };
            }
            // console.table(autoOptions.city)
            console.table(autoOptions)
            autocomplete = new AMap.Autocomplete(autoOptions);
            AMap.event.addListener(autocomplete, "select", function (e) {
                // TODO 针对选中的poi实现自己的功能
                placeSearch.setCity(e.poi.adcode);
                placeSearch.search(e.poi.name);
                console.log(e);
                $.closePopup("#addressStartAll");
                $("#addressStart").text(e.poi.name);
                $("#addressStart").attr("vname", e.poi.name);
                $("#addressStart").attr("vcity", e.poi.name);
                $("#addressStart").attr("vlng", e.poi.location.lng);//经度
                $("#addressStart").attr("vlat", e.poi.location.lat);//纬度
            });
        });
    }

    // 切换城市
    $(document).on("click", "#cityAddress2", function() {
        $("#posCityBox2").show();
    });
    var autoOptions2;
    $.each($("#posCityBox2 a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress2 span").text($(this).text());
            $("#posCityBox2").hide();
            autoOptions2 = {
                city: $("#cityAddress2 span").text(), 								// 城市，默认全国
                input: "addressText2"						// 使用联想输入的input的id
            };
            cityChoice2(autoOptions2);
            console.table(autoOptions2)
        });
    });
    cityChoice2(autoOptions2);
    function cityChoice2(autoOptions2, vcity){

        var placeSearch = new AMap.PlaceSearch({
            city: '周口',
            map: map
        })
        // 你从哪儿出发-本市
        if(autoOptions2 == undefined){
            autoOptions2 = {
                city: '周口', 								// 城市，默认全国
                input: "addressText2"						// 使用联想输入的input的id
            };
        }
        console.table(autoOptions2)
        autocomplete = new AMap.Autocomplete(autoOptions2);
        AMap.event.addListener(autocomplete, "select", function(e){
            $.closePopup("#addressStartAll2");
            $("#addressEnd").text(e.poi.name);
            $("#addressEnd").attr("vname", e.poi.name);
            $("#addressEnd").attr("vlng", e.poi.location.lng);//经度
            $("#addressEnd").attr("vlat", e.poi.location.lat);//纬度
            beginPlace = "周口",
                beginDetail = $("#addressStart").attr("vname"),
                endPlace = "周口",
                endDetail = $("#addressEnd").attr("vname"),
                lonlatBegin = {
                    lng: $("#addressStart").attr("vlng"),
                    lat: $("#addressStart").attr("vlat")
                },
                lonlatEnd = {
                    lng: $("#addressEnd").attr("vlng"),
                    lat: $("#addressEnd").attr("vlat")
                };
            var dataStore = {
                type: 2,// 1乘客 2载客
                region: 0,// 0本市 1跨市
                begin_place: beginPlace,// 起点位置
                begin_detail: beginDetail,// 起点位置详细地址
                end_place: endPlace,// 终点位置
                end_detail: endDetail,// 终点位置详细地址
                lonlat_begin: lonlatBegin,// 起点经纬度
                lonlat_end: lonlatEnd,// 终点经纬度
            }
            location.href='{:url("index/sunfc.publish/driver_issue")}?region=0'
                +'&&begin_place='+dataStore.begin_place+'&&type='+dataStore.type+'&&begin_detail='
                +dataStore.begin_detail +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
        });
    }


    // 切换城市
    $(document).on("click", "#cityAddress3", function() {
        $("#posCityBox3").show();
    });
    var autoOptions3;
    $.each($("#posCityBox3 a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress3 span").text($(this).text());
            $("#posCityBox3").hide();
            autoOptions3 = {
                city: $("#cityAddress3 span").text(), 								// 城市，默认全国
                input: "addressText3"						// 使用联想输入的input的id
            };
            cityChoice3(autoOptions3);
            console.table(autoOptions3)
        });
    });
    cityChoice3(autoOptions3);
    function cityChoice3(autoOptions3, vcity){

        // 你从哪儿出发-跨市
        if(autoOptions3 == undefined){
            autoOptions3 = {
                city: '周口', 								// 城市，默认全国
                input: "addressText3"						// 使用联想输入的input的id
            };
        }
        autocomplete= new AMap.Autocomplete(autoOptions3);
        AMap.event.addListener(autocomplete, "select", function(e){
            // TODO 针对选中的poi实现自己的功能
            console.log(e);
            $.closePopup("#addressStartAll3");
            $("#addressStartKua").text(e.poi.name);
            $("#addressStartKua").attr("vname", e.poi.name);
            $("#addressStartKua").attr("vlng", e.poi.location.lng);//经度
            $("#addressStartKua").attr("vlat", e.poi.location.lat);//纬度
        });
    }


    // 切换城市
    $(document).on("click", "#cityAddress4", function() {
        $("#posCityBox4").show();
    });
    var autoOptions4;
    $.each($("#posCityBox4 a"), function (k,v) {
        $(v).click(function () {
            $("#cityAddress4 span").text($(this).text());
            $("#posCityBox4").hide();
            autoOptions4 = {
                city: $("#cityAddress4 span").text(), 								// 城市，默认全国
                input: "addressText4"						// 使用联想输入的input的id
            };
            cityChoice4(autoOptions4);
        });
    });
    cityChoice4(autoOptions4);
    function cityChoice4(autoOptions4, vcity){

        // 你要去哪儿-跨市
        if(autoOptions4 == undefined){
            autoOptions4 = {
                city: '周口', 								// 城市，默认全国
                input: "addressText4"						// 使用联想输入的input的id
            };
        }
        autocomplete= new AMap.Autocomplete(autoOptions4);
        AMap.event.addListener(autocomplete, "select", function(e){
            $.closePopup("#addressStartAll4");
            // if($("#navbarShi .weui-bar__item--on").attr("vid") == 0){
            $("#addressEndKua").text(e.poi.name);
            $("#addressEndKua").attr("vname", e.poi.name);
            $("#addressEndKua").attr("vlng", e.poi.location.lng);//经度
            $("#addressEndKua").attr("vlat", e.poi.location.lat);//纬度
            beginPlace = "周口",
                beginDetail = $("#addressStartKua").attr("vname"),
                // endPlace = "周口1111",
                endDetail = $("#addressEndKua").attr("vname"),
                lonlatBegin = {
                    lng: $("#addressStartKua").attr("vlng"),
                    lat: $("#addressStartKua").attr("vlat")
                },
                lonlatEnd = {
                    lng: $("#addressEndKua").attr("vlng"),
                    lat: $("#addressEndKua").attr("vlat")
                };
            var dataStore = {
                type: 2,// 1乘客 2载客
                region: 1,// 0本市 1跨市
                begin_place: beginPlace,// 起点位置
                begin_detail: beginDetail,// 起点位置详细地址
                end_place: endPlace,// 终点位置
                end_detail: endDetail,// 终点位置详细地址
                lonlat_begin: lonlatBegin,// 起点经纬度
                lonlat_end: lonlatEnd,// 终点经纬度
            }

            //store.set("dataStore", dataStore);
            //console.log(store.get('dataStore'));
            //return false;
            location.href='{:url("index/sunfc.publish/driver_issue")}?region=1'
                +'&&begin_place='+dataStore.begin_place+'&&type='+dataStore.type+'&&begin_detail='+dataStore.begin_detail
                +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
        });
    }


    // 选择地址
    var beginPlace, beginDetail, endPlace, endDetail, lonlatBegin, lonlatEnd;
    // var windowsArr = [];
    // var marker = [];
    var map = new AMap.Map("mapContainer", {
        resizeEnable: true,
        center: [114.689762, 33.641854],		// 地图中心点
        zoom: 13,								// 地图显示的缩放级别
        keyboardEnable: false
    });
    AMap.plugin(['AMap.Autocomplete','AMap.PlaceSearch'],function(){
        var placeSearch = new AMap.PlaceSearch({
            city:'郑州',
            map:map
        })
        // 你从哪儿出发-本市
        // var autoOptions = {
        //     city: "周口", 								// 城市，默认全国
        //     input: "addressText1"						// 使用联想输入的input的id
        // };
        // autocomplete= new AMap.Autocomplete(autoOptions);
        // AMap.event.addListener(autocomplete, "select", function(e){
        //     // TODO 针对选中的poi实现自己的功能
        //     placeSearch.setCity(e.poi.adcode);
        //     placeSearch.search(e.poi.name);
        //     console.log(e);
        //     $.closePopup("#addressStartAll");
        //     $("#addressStart").text(e.poi.name);
        //     $("#addressStart").attr("vname", e.poi.name);
        //     $("#addressStart").attr("vlng", e.poi.location.lng);//经度
        //     $("#addressStart").attr("vlat", e.poi.location.lat);//纬度
        // });
        // 你从哪儿出发-跨市
        /*var autoOptions3 = {
            city: "周口", 								// 城市，默认全国
            input: "addressText3"						// 使用联想输入的input的id
        };
        autocomplete= new AMap.Autocomplete(autoOptions3);
        AMap.event.addListener(autocomplete, "select", function(e){
            // TODO 针对选中的poi实现自己的功能
            placeSearch.setCity(e.poi.adcode);
            placeSearch.search(e.poi.name)
            console.log(e);
            $.closePopup("#addressStartAll3");
            $("#addressStartKua").text(e.poi.name);
            $("#addressStartKua").attr("vname", e.poi.name);
            $("#addressStartKua").attr("vlng", e.poi.location.lng);//经度
            $("#addressStartKua").attr("vlat", e.poi.location.lat);//纬度
        });
*/


        // 你要去哪儿-本市
        /*var autoOptions2 = {
            city: "周口", 								// 城市，默认全国
            input: "addressText2"						// 使用联想输入的input的id
        };
        autocomplete= new AMap.Autocomplete(autoOptions2);
        AMap.event.addListener(autocomplete, "select", function(e){
            $.closePopup("#addressStartAll2");
            $("#addressEnd").text(e.poi.name);
            $("#addressEnd").attr("vname", e.poi.name);
            $("#addressEnd").attr("vlng", e.poi.location.lng);//经度
            $("#addressEnd").attr("vlat", e.poi.location.lat);//纬度
            beginPlace = "周口",
                beginDetail = $("#addressStart").attr("vname"),
                endPlace = "周口",
                endDetail = $("#addressEnd").attr("vname"),
                lonlatBegin = {
                    lng: $("#addressStart").attr("vlng"),
                    lat: $("#addressStart").attr("vlat")
                },
                lonlatEnd = {
                    lng: $("#addressEnd").attr("vlng"),
                    lat: $("#addressEnd").attr("vlat")
                };
            var dataStore = {
                type: 2,// 1乘客 2载客
                region: 0,// 0本市 1跨市
                begin_place: beginPlace,// 起点位置
                begin_detail: beginDetail,// 起点位置详细地址
                end_place: endPlace,// 终点位置
                end_detail: endDetail,// 终点位置详细地址
                lonlat_begin: lonlatBegin,// 起点经纬度
                lonlat_end: lonlatEnd,// 终点经纬度
            }
            // console.log(dataStore.lonlat_begin.lat);
            //store.set("dataStore", dataStore);
            //console.log(store.get('dataStore'));
            //var dataStore=store.get('dataStore');
            //alert(dataStore.end_place);
            location.href='{:url("index/sunfc.publish/driver_issue")}?region=0'
                +'&&begin_place='+dataStore.begin_place+'&&type='+dataStore.type+'&&begin_detail='
                +dataStore.begin_detail +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
        });*/

        /*// 你要去哪儿-跨市
        var autoOptions4 = {
            city: "周口", 								// 城市，默认全国
            input: "addressText4"						// 使用联想输入的input的id
        };
        autocomplete= new AMap.Autocomplete(autoOptions4);
        AMap.event.addListener(autocomplete, "select", function(e){
            $.closePopup("#addressStartAll4");
            // if($("#navbarShi .weui-bar__item--on").attr("vid") == 0){
            $("#addressEndKua").text(e.poi.name);
            $("#addressEndKua").attr("vname", e.poi.name);
            $("#addressEndKua").attr("vlng", e.poi.location.lng);//经度
            $("#addressEndKua").attr("vlat", e.poi.location.lat);//纬度
            beginPlace = "周口",
                beginDetail = $("#addressStartKua").attr("vname"),
                // endPlace = "周口1111",
                endDetail = $("#addressEndKua").attr("vname"),
                lonlatBegin = {
                    lng: $("#addressStartKua").attr("vlng"),
                    lat: $("#addressStartKua").attr("vlat")
                },
                lonlatEnd = {
                    lng: $("#addressEndKua").attr("vlng"),
                    lat: $("#addressEndKua").attr("vlat")
                };
            var dataStore = {
                type: 2,// 1乘客 2载客
                region: 1,// 0本市 1跨市
                begin_place: beginPlace,// 起点位置
                begin_detail: beginDetail,// 起点位置详细地址
                end_place: endPlace,// 终点位置
                end_detail: endDetail,// 终点位置详细地址
                lonlat_begin: lonlatBegin,// 起点经纬度
                lonlat_end: lonlatEnd,// 终点经纬度
            }

            //store.set("dataStore", dataStore);
            //console.log(store.get('dataStore'));
            //return false;
            location.href='{:url("index/sunfc.publish/driver_issue")}?region=1'
                +'&&begin_place='+dataStore.begin_place+'&&type='+dataStore.type+'&&begin_detail='+dataStore.begin_detail
                +'&&end_place='+dataStore.end_place+'&&end_detail='+dataStore.end_detail
                +'&&lonlat_begin='+dataStore.lonlat_begin.lng+','+dataStore.lonlat_begin.lat
                +'&&lonlat_end='+dataStore.lonlat_end.lng+','+dataStore.lonlat_end.lat;
        });*/
    });
    // store.remove('dataStore'); //清楚缓存

    // 本市
    $(document).on("click", "#addressStart", function() {
        $("#addressStartAll").popup();
    });
    $(document).on("click", "#aaa", function() {
        $.closePopup("#addressStartAll");
    });
    $(document).on("click", "#addressEnd", function() {
        if($("#addressStart").attr("vname") == undefined){
            $.toast("先选择起点", "text");
        }else{
            $("#addressStartAll2").popup();
        }
    });
    // 跨市
    $(document).on("click", "#addressStartKua", function() {
        $("#addressStartAll3").popup();
    });
    $(document).on("click", "#aaa3", function() {
        $.closePopup("#addressStartAll3");
    });
    $(document).on("click", "#aaa2", function() {
        $.closePopup("#addressStartAll2");
    });
    $(document).on("click", "#addressEndKua", function() {
        if($("#addressStartKua").attr("vname") == undefined){
            $.toast("先选择起点", "text");
        }else{
            $("#addressStartAll4").popup();
        }
    });
    $(document).on("click", "#aaa4", function() {
        $.closePopup("#addressStartAll4");
    });


</script>
<script type="text/javascript" src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>
<script src="/res/vue.js"></script>




  <!--通过vue进行拿数据-->
<script>
    //vue对象
    var app = new Vue({
        el: '#app',
        data: {
            check: [],
            sameCity: {},
            boastCity:{},
            leg:{}


        }
    });
    $(function () {
        sameCity();
        // stride();
    });
    // 这个是最新发布的同城信息
    function  sameCity() {
        $.get('/index/sunfc.publish/sameCity',
            function (res) {
                console.log(res.data)
                app.sameCity= res.data;
                app.leg = '';
            }
        );
    }
    function  boastCity() {
        $.get('/index/sunfc.publish/boastCity',
            function (res) {
            console.log(res.data.length)
                console.log(res.data)
                app.boastCity= res.data;
                app.leg = res.data.length;
            }
        );
    }


</script>




</body>
</html>

